home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / jam / jamdisk7 / inc9110b.lzh / include / stdio.h < prev    next >
C/C++ Source or Header  |  1991-07-15  |  4KB  |  158 lines

  1. /*
  2.  * Libraries and headers for PDC release 3.3 (C) 1989 Lionel Hummel.
  3.  * PDC Software Distribution (C) 1989 Lionel Hummel and Paul Petersen.
  4.  * PDC I/O Library (C) 1987 by J.A. Lydiatt.
  5.  *
  6.  * This code is freely redistributable upon the conditions that this 
  7.  * notice remains intact and that modified versions of this file not
  8.  * be included as part of the PDC Software Distribution without the
  9.  * express consent of the copyright holders.  No warrantee of any
  10.  * kind is provided with this code.  For further information, contact:
  11.  *
  12.  *  PDC Software Distribution    Internet:                     BIX:
  13.  *  P.O. Box 4006             or hummel@cs.uiuc.edu            lhummel
  14.  *  Urbana, IL  61801-8801       petersen@uicsrd.csrd.uiuc.edu
  15.  */
  16.  
  17. /*
  18.  * stdio.h
  19.  *
  20.  * 02.3.91 sjw; use K&R2 prototypes
  21.  * 17.3.91 sjw; move fdopen(), fileno() to unix.h
  22.  * 15.7.91 sjw; move them back again.
  23.  */
  24.  
  25. #ifndef __STDIO_H__
  26. #define __STDIO_H__
  27.  
  28. /* - bit of efficiency here - */
  29.  
  30. #ifndef __STDDEF_H__
  31. #include <stddef.h>
  32. #endif
  33.  
  34. #ifndef __STDARG_H__
  35. #include <stdarg.h>
  36. #endif
  37.  
  38. struct _iobuf {
  39.    struct _iobuf *next;            /* Link to next buffer in chain              */
  40.    int   _fileunit;             /* File descriptor                        */
  41.    char *_filecpos;        /* Current position in buffer          */
  42.    char *_fileend;        /* Last position in buffer          */
  43.    long  _filelen;        /* Buffer size                  */
  44.    char *_filebufp;               /* za buffer                              */
  45.    char  _filebyte;        /* Instant one-byte buffer                */
  46.    char  _padbyte;
  47.    unsigned short _fileflag;    /* Condition flags                        */
  48. };
  49.  
  50. #define FILE struct _iobuf
  51. extern FILE _fdevtab[];
  52.  
  53. #define BUFSIZ          (1024)
  54. #define MAX_READ_SIZE    (1024)
  55.  
  56. #define _FILEACTIVE    0x01
  57. #define _FILEISDIRTY    0x02
  58. #define _FILEATEOF    0x04
  59. #define _FILEBAD    0x08
  60. #define _FILEISDYNA    0x10
  61. #define _FILEISTTY    0x20
  62.  
  63. #define _IOREAD         0x1
  64. #define _IOWRT          0x2
  65. #define _IOEOF          0x10
  66. #define _IOERR          0x20
  67. #define _IORW           0x100
  68.  
  69. #define EOF        (-1)
  70.  
  71. /* defines for fseek() */
  72. #define SEEK_SET    0
  73. #define SEEK_CUR    1
  74. #define SEEK_END    2
  75.     
  76. extern FILE *stdin;
  77. extern FILE *stdout;
  78. extern FILE *stderr;
  79.  
  80. /* the functions ... */
  81.  
  82. /* B1.1 */
  83.  
  84. FILE   *fopen(const char *filename, const char *mode);
  85. FILE   *freopen(const char *filename, const char *mode, FILE *stream);
  86. int     fflush(FILE *stream);
  87. int     fclose(FILE *stream);
  88. #ifndef __SYSTEM_H__
  89. #include <system.h>
  90. #endif
  91. #define remove(fileName) unlink(fileName)
  92. int     rename(const char *oldname, const char *newname);
  93. FILE   *tmpfile(void);
  94. char   *tmpnam(char *s);
  95. #if 0
  96. int     setvbuf(FILE *stream, char *buf, int mode, size_t size);
  97. void    setbuf(FILE *stream, char *buf);
  98. #endif
  99.  
  100. /* B1.2 */
  101.  
  102. int     fprintf(FILE *stream, const char *format, ...);
  103. int     printf(const char *format, ...);
  104. int     sprintf(char *s, const char *format, ...);
  105. int     vfprintf(FILE *stream, const char *format, va_list arg);
  106. int     vprintf(const char *format, va_list arg);
  107. int     vsprintf(char *s, const char *format, va_list arg);
  108.  
  109. /* B1.3 */
  110.  
  111. int     fscanf(FILE *stream, const char *format, ...);
  112. int     scanf(const char *format, ...);
  113. int     sscanf(const char *s, const char *format, ...);
  114.  
  115. /* B1.4 */
  116. int     fgetc(FILE *stream);
  117. char   *fgets(char *s, int n, FILE *stream);
  118. int     fputc(int c, FILE *stream);
  119. int     fputs(const char *s, FILE *stream);
  120. #define getc(c)        fgetc((c))
  121. #define getchar()    fgetc(stdin)
  122. #if 0
  123. char   *gets(char *s);
  124. #endif
  125. #define putc(c,s)    fputc((c),(s))
  126. #define putchar(c)    fputc((c), stdout)
  127. int     puts(const char *s);
  128. int     ungetc(int c, FILE *stream);
  129.  
  130. /* B1.5 */
  131. size_t  fread(void *ptr, size_t size, size_t nobj, FILE *stream);
  132. size_t  fwrite(const void *ptr, size_t size, size_t nobj, FILE *stream);
  133.  
  134. /* B1.6 */
  135.  
  136. int     fseek(FILE *stream, long offset, int origin);
  137. long    ftell(FILE *stream);
  138. void    rewind(FILE *stream);
  139. #if 0
  140. int     fgetpos(FILE *stream, long *ptr);  /* _nb_ not fpos_t */
  141. int     fsetpos(FILE *stream, const long *ptr);
  142. #endif
  143.  
  144. /* B1.7 */
  145.  
  146. #define clearerr(p)     ((p)->_fileflag &= ~(_FILEBAD|_FILEATEOF))
  147. #define feof(p)         (((p)->_fileflag&_FILEATEOF)!=0)
  148. #define ferror(p)       (((p)->_fileflag&_FILEBAD)!=0)
  149. void    perror(const char *s);
  150.  
  151. /* extras */
  152.  
  153. FILE   *fdopen(int desc, const char *mode);
  154. #define fileno(p)       ((p)->_fileunit)
  155.  
  156. #endif /* __STDIO_H__ */
  157.  
  158.